package com.joysuch.wwyt.workflow.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * @author qingzhou
 * 2020-02-12
 */
@Data
@Entity
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Table(name = "WWYT_WORKFLOW_PROCESS")
@SQLDelete(sql = "update WWYT_WORKFLOW_PROCESS set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_WORKFLOW_PROCESS set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class WorkFlowProcess implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键ID")
    private Long id;

    //业务名词
    @ApiModelProperty("业务名称")
    private String bizName;

    @ApiModelProperty("业务类型名称")
    private String bizTypeName;

    //业务流程标识
    @ApiModelProperty("业务流程定义标识")
    private String definitionKey;

    //模型id
    @ApiModelProperty("模板id")
    private String modelId;
    //表单json
    @ApiModelProperty("表单json")
    private String formJson;

    //流程模板json
    @ApiModelProperty("流程模板json")
    private String modelJson;

    //表单字段Key-Label Json
    @ApiModelProperty("表单字段Key-Label Json")
    private String formKeyLabelJson;

    //是否有类型
    @ApiModelProperty("是否有业务类型")
    private Integer type;


    @ApiModelProperty("任务节点列表")
    private String taskNameList;

    //流程部署信息：
    @ApiModelProperty("流程部署ID")
    private String deploymentId;

    @ApiModelProperty("流程部署名称")
    private String deploymentName;

    @ApiModelProperty("流程部署时间")
    private java.time.LocalDateTime deploymentTime;

    @ApiModelProperty("统计同步开关")
    private int syncStatusOnOff;


    @ApiModelProperty("启用位置服务")
    private Boolean locationServiceOpen;
    @ApiModelProperty("启用打印")
    private Boolean printOpen;

    @ApiModelProperty("业务编号前缀 eg:动火:DH")
    private String codePrefix;

    @ApiModelProperty("模板数据")
    private String printTemplate;

    @ApiModelProperty("权限配置")
    private String authConfig;

    @ApiModelProperty("编码策略id")
    private Long codeStrategyId;

    @Transient
    //编码策略名称
    private String codeStrategyName;

    @ApiModelProperty("流程类型")
    private Integer processType;

    //租户
    @ApiModelProperty("租户")
    private Long tenentId;
    //组织机构代码
    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @org.springframework.data.annotation.CreatedBy
    @ApiModelProperty("创建人")
    private Long createBy;

    @CreatedDate
    @ApiModelProperty("创建时间")
    private Date createTime;

    @org.springframework.data.annotation.LastModifiedBy
    @ApiModelProperty("更新人")
    private Long updateBy;

    @LastModifiedDate
    @ApiModelProperty("更新时间")
    private Date updateTime;

    //删除标记
    @ApiModelProperty("删除标记")
    private String deleteFlag;

    @ApiModelProperty(value = "报警级别名称:蓝-黄-橙-红")
    private String levelName;

    @ApiModelProperty(value = "推送时间")
    private java.time.LocalDateTime pushTime;

}
